﻿using System.Diagnostics;
using System.IO;

namespace CMWVS.Core.Mono
{
    public class CreateMonoConfig : ICreateMonoConfig
    {
        #region Constructor

        private CreateMonoConfig()
        {
        }

        public CreateMonoConfig(DirectoryInfo monoRootDirectory)
        {
            m_MonoRootDirectory = monoRootDirectory;
            Trace.Assert(m_MonoRootDirectory.Exists);
        }

        #endregion Constructor

        private DirectoryInfo m_MonoRootDirectory;

        #region ICreateMonoConfig Members

        public MonoConfig Create()
        {
            FileInfo comiler = new FileInfo(System.IO.Path.Combine(m_MonoRootDirectory.FullName, "bin", "xbuild.bat"));
            FileInfo monoexe = new FileInfo(System.IO.Path.Combine(m_MonoRootDirectory.FullName, "bin", "mono.exe"));
            return new MonoConfig(true, m_MonoRootDirectory, comiler, monoexe);
        }

        #endregion ICreateMonoConfig Members
    }
}